local skel = fk.CreateSkill{
    name="wegame_2__chongling",
    tags={Skill.Compulsory},
}
local U = require "packages/utility/utility"


Fk:loadTranslationTable{
    ["wegame_2__chongling"] = "冲临",
    [":wegame_2__chongling"] = [[锁定技，其他角色的回合结束时，你执行一个仅有前X个主要阶段的额外回合（X为你本回合使用牌数）。]],
    ["#chongling-use"] = "冲临：执行一个仅有前X个主要阶段的额外回合（X为你本回合使用牌数）",
}

skel:addEffect(fk.TurnEnd,{
    can_trigger = function (self, event, target, player, data)

        if target~=player and player:hasSkill(skel.name)then
            local y = 0
            local room=player.room
            y = y + #room.logic:getEventsByRule(GameEvent.UseCard, 999, function (e)
                return e.data.from == player
            end, nil, Player.HistoryTurn)
            if y > 0 then
                event:setCostData(self, {number =y})
                return true
            end
        end
        return false
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local num=event:getCostData(self).number
        num = math.min(num,4)
        local total_list={3,4,5,6}
        local do_lise=table.slice(total_list,1,num+1)
        player:gainAnExtraTurn(true,skel.name,do_lise)
    end,

})

return skel